import React,{Component} from 'react'
import {HashRouter,Route,Switch,Redirect} from 'react-router-dom'
import App from './App'
import Home from './pages/Home'
import Admin from './admin'
import Common from './common'
import Login from './pages/login'
import Buttons from './pages/ui/buttons'
import Modals from './pages/ui/modals'
import NoMatch from './pages/nomatch'
import Loadings from './pages/ui/loadings';
import Notices from './pages/ui/notices'
import Messages from './pages/ui/messages'
import Tab from './pages/ui/tabs'
import Gallery from './pages/ui/gallery'
import Carousels from './pages/ui/carousel'
import LoginForm from './pages/ui/Form/login'
import RegisterForm from './pages/ui/Form/register'
import BaseTable from './pages/ui/Table/baseTable'
import HighTable from './pages/ui/Table/highTable'
import City from './pages/city'
import User from './pages/user'
import Order from './pages/order'
import BikeMap from './pages/map'
import Permission from './pages/permission'
import OrderDetail from './pages/order/detail'
import Bar from './pages/charts/Bar'
import Line from './pages/charts/Line'
import Pie from './pages/charts/Pie'
import Rich from './pages/rich'

export default class IRouter extends Component {
    render(){
        return (
            <HashRouter>
                <App>
                    <Switch>
                        <Route path="/login" component={Login}></Route>
                        <Route path="/common" render={() =>
                            <Common>
                                <Switch>
                                    <Route path="/common/order/detail/:orderId" component={OrderDetail} />
                                </Switch>
                            </Common>
                        }
                        />
                        <Route path="/" render={() =>
                            <Admin>
                                <Switch>
                                    <Route path="/home" component={Home}></Route>
                                    <Route path="/ui/buttons" component={Buttons}></Route>
                                    <Route path="/ui/modals" component={Modals}></Route>
                                    <Route path="/ui/loadings" component={Loadings}></Route>
                                    <Route path="/ui/notification" component={Notices}></Route>
                                    <Route path="/ui/messages" component={Messages}></Route>
                                    <Route path="/ui/tabs" component={Tab}></Route>
                                    <Route path="/ui/gallery" component={Gallery}></Route>
                                    <Route path="/ui/carousel" component={Carousels}></Route>
                                    <Route path="/form/login" component={LoginForm}></Route>
                                    <Route path="/form/reg" component={RegisterForm}></Route>
                                    <Route path="/table/basic" component={BaseTable}></Route>
                                    <Route path="/table/high" component={HighTable}></Route>
                                    <Route path="/city/" component={City}></Route>
                                    <Route path="/order/" component={Order}></Route>
                                    <Route path="/user/" component={User}></Route>
                                    <Route path="/bikeMap/" component={BikeMap}></Route>
                                    <Route path="/permission/" component={Permission}></Route>
                                    <Route path="/charts/bar" component={Bar}></Route>
                                    <Route path="/charts/line" component={Line}></Route>
                                    <Route path="/charts/pie" component={Pie}></Route>
                                    <Route path="/rich" component={Rich}></Route>
                                    <Redirect to="/home"></Redirect>
                                    {/* <Route component={NoMatch} /> */}
                                </Switch>
                            </Admin>
                        }></Route>
                    </Switch>
                </App>
            </HashRouter>
        )
    }
}
